import cv2
import face_have as ha


# 创建LBPH人脸识别器
RECOGNIZER = cv2.face.LBPHFaceRecognizer_create()
PASS_CONF = 45     # LBPH的最高评分
# 加载级联分类器
faceCascade = cv2.CascadeClassifier("F://01-learn//01-program//enviroment//venv//Lib//site-packages"
                                    "//cv2//data//haarcascade_frontalface_default.xml")

ha.load_employee_pic()
# 摄像头读取一帧后匹配 查看有没有匹配得 然后 摄像头一直处于开启状态
video = cv2.VideoCapture(0, cv2.CAP_DSHOW)
success, frame = video.read()
while success and cv2.waitKey(1) == -1:
    cv2.imshow("frame", frame)
    faces = faceCascade.detectMultiScale(frame, 1.15)
    if len(faces) > 0:
        print("有")
    else:
        print("无")

    success, frame = video.read()